<?php

/**
 * @author @author Samrat Khan & Sadik Sarfaraz - May 19, 2013
 */
require 'top.inc.php';
$formLoad = new Form();
if(isset($_SESSION['user']) && $_SESSION['user']['utype'] == 1 || $_SESSION['user']['utype'] == 2 || $_SESSION['user']['utype'] == 3 || $_SESSION['user']['utype'] == 4) {
    $sess_cusID = $_SESSION['user']['cus_id'];
?>
<form name="addFaultyExport" id="addFaultyExport" method="post">
<?php
echo "<table class=\"form-inline row-fluid table table-striped table-bordered\">";
    echo "<tr>";
        echo "<th>" . $faulty_export['serialno'] . "</th>";
        echo "<th>" . $faulty_export['project_id'] . "</th>";
        echo "<th>" . $faulty_export['productid'] . "</th>";
        echo "<th>" . $faulty_export['description'] . "</th>";
        echo "<th>" . $faulty_export['revisionstate'] . "</th>";
        echo "<th>" . $faulty_export['boxno'] . "</th>";
        echo "<th>" . $faulty_export['uom'] . "</th>";
        echo "<th>" . $faulty_export['faulty_export_quantity'] . "</th>";
        echo "<th>" . $faulty_export['handedoverto'] . "</th>";
        echo "<th>" . $faulty_export['manufacturingdate'] . "</th>";
        echo "<th>" . $faulty_export['faultydocketnumber'] . "</th>";
        echo "<th>" . $faulty_export['docketdate'] . "</th>";
        echo "<th>" . $faulty_export['siteid'] . "</th>";
        echo "<th>" . $faulty_export['warehouse_id'] . "</th>";
        echo "<th>" . $faulty_export['rr_rma'] . "</th>";
        echo "<th>" . $faulty_export['export_rma'] . "</th>";
        echo "<th>" . $faulty_export['rr_invoiceno'] . "</th>";
        echo "<th>" . $faulty_export['rr_date'] . "</th>";
        echo "<th>" . $faulty_export['rr_mawb'] . "</th>";
        echo "<th>" . $faulty_export['rr_awb'] . "</th>";
        echo "<th>" . $faulty_export['remarks'] . "</th>";
        echo "<th>" . "&nbsp;" . "</th>";
    echo "</tr>";
    
    echo "<tr>";
        echo "<td>" . $formLoad->textField("serialno", "", "faulty_export_sn", $stock_in['serialno']) . "</td>";
        echo "<td>";
            echo "<select name='project_id'>";
                echo getProjects(cus_id, $sess_cusID, $db);
            echo "</select>";
        echo "</td>";
        echo "<td>" . $formLoad->textField("productid", "", "productid", $faulty_export['productid']) . "</td>";
        echo "<td>" . $formLoad->textArea("description", "", "description") . "</td>";
        echo "<td>" . $formLoad->textField("revisionstate", "", "revisionstate", $faulty_export['revisionstate']) . "</td>";
        echo "<td>" . $formLoad->textField("boxno", "", "boxno", $faulty_export['boxno']) . "</td>";
        echo "<td>";
            echo "<select name='uom'>";
                echo getUOM($db);
            echo "</select>";
        echo "</td>";
        echo "<td>" . $formLoad->textField("faulty_export_quantity", "", "", $faulty_export['faulty_export_quantity']) . "</td>";
        echo "<td>" . $formLoad->textField("handedoverto", "", "", $faulty_export['handedoverto']) . "</td>";
        echo "<td>" . $formLoad->textFieldDate("manufacturingdate", "input-append date", "manufacturingdate", $faulty_export['manufacturingdate']) . "</td>";
        echo "<td>" . $formLoad->textField("faultydocketnumber", "", "", $faulty_export['faultydocketnumber']) . "</td>";
        echo "<td>" . $formLoad->textFieldDate("docketdate", "input-append date", "docketdate", $faulty_export['docketdate']) . "</td>";
        echo "<td>" . $formLoad->textField("siteid", "", "siteid", $faulty_export['siteid']) . "</td>";
        echo "<td>";
            echo "<select name='warehouse_id'>";
                echo getWarehousesCode($db);
            echo "</select>";
        echo "</td>";
        echo "<td>" . $formLoad->textField("rr_rma", "", "", $faulty_export['rr_rma']) . "</td>";
        echo "<td>" . $formLoad->textField("export_rma", "", "", $faulty_export['export_rma']) . "</td>";
        echo "<td>" . $formLoad->textField("rr_invoiceno", "", "", $faulty_export['rr_invoiceno']) . "</td>";
        echo "<td>" . $formLoad->textFieldDate("rr_date", "input-append date", "rr_date", $faulty_export['rr_date']) . "</td>";
        echo "<td>" . $formLoad->textField("rr_mawb", "", "", $faulty_export['rr_mawb']) . "</td>";
        echo "<td>" . $formLoad->textField("rr_awb", "", "", $faulty_export['rr_awb']) . "</td>";
        echo "<td>" . $formLoad->textArea("remarks", "", "remarks") . "</td>";
        echo '<input type="hidden" name="userid" value="'.$_SESSION['user']['id'].'" />';
        echo '<input type="hidden" name="cus_id" value="'.$_SESSION['user']['cus_id'].'" />';
        echo '<input type="hidden" name="session_id" value="'.  session_id() .'" />';
        echo '<input type="hidden" name="junkentry" value="0" />';
        echo "<td>";
            echo '<input id="AddFaultyExportBtn" class="btn btn-primary" type="submit" value="Add Faulty Export" name="addFaultyExport" />';
        echo "</td>";
    echo "</tr>";
echo "<table>";
?>
</form>

<div id="show"></div>
<?php
}
include 'bottom.inc.php';
?>
